var App = function() {
     var remainTime = function(iTime,id,str1,str2) {
            var timer = null;
            var iDay,iHour,iMinute,iSecond;
            var sDay = "",sHour = "",sMinute = "",sSecond = "",sTime;
            function getTime(){
                if (iTime >= 0) {
                    iTime--;
                    iDay = parseInt(iTime/24/3600);
                    if (iDay > 0)
                    {
                        sDay = iDay + "天";
                    }
                    iHour = parseInt((iTime/3600)%24);
                    if (iHour > 0){
                        sHour = iHour + "小时";
                    }
                    iMinute = parseInt((iTime/60)%60);
                    if (iMinute > 0){
                        sMinute = iMinute + "分钟";
                    }
                    iSecond = parseInt(iTime%60);
                    if (iSecond >= 0){
                        sSecond = iSecond + "秒";
                    }

                    if ((sDay == "") && (sHour == "")){
                        sTime = sMinute + sSecond;
                    } else {
                        sTime = sDay + sHour + sMinute + sSecond;
                    }
                    $("#"+id).html(str1 + sTime);

                    if (iTime == 0) {
                        clearInterval(timer);
                        $("#"+id).hide();
                        $("#"+id).prev().html(str2);
                        $("#"+id).next().show();
                    }

                }
                
            }
            var timer = setInterval(getTime, 1000);
        };

        return{
            countDown: function(iTime,id,str1,str2) {
                remainTime(iTime,id,str1,str2);
            }
        };
}();